package com.ruoyi.system.controller;

import com.ruoyi.system.pojo.vo.RegionVO;
import com.ruoyi.system.service.RegionService;
import com.ruoyi.system.utils.PageResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Description:
 *
 * @author JourWon
 * @date Created on 2025/5/15
 */
@RestController
@RequestMapping("/vm-service")
public class RegionController {

    @Autowired
    private RegionService regionService;

    /**
     * 查询区域管理列表
     * @param pageIndex
     * @param pageSize
     * @param name
     * @return
     */
    @GetMapping("/region/search")
    public ResponseEntity<PageResult<RegionVO>> searchRegions(
            @RequestParam(required = false) Integer pageIndex,
            @RequestParam(required = false) Integer pageSize,
            @RequestParam(required = false) String name) {

        PageResult<RegionVO> result = regionService.searchRegions(pageIndex, pageSize, name);
        return ResponseEntity.ok(result);
    }
}
